home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Information
/
CSMP Digest
/
volume 3
/
csmp-digest-v3-122
< prev
next >
Wrap
Text File
|
1995-12-31
|
69KB
|
1,812 lines
C.S.M.P. Digest Sun, 19 Nov 95 Volume 3 : Issue 122
Today's Topics:
Asynchronous Serial Com.
Auto-Installing Software
Deferred Task Help...
GX Font menus
GetWRefCon returns NULL if app is in background?
How to add plug-in`s to an application
How to call 68K code from Power PC (Was: Apple OneScanner Libraries: how to use them in PPC Code)
Missing-character glyphs in double-byte fonts?
Shared library version control (Was: Save me from MFC!!!)
Video Paging versus CopyBits...
The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
(pottier@clipper.ens.fr).
The digest is a collection of article threads from the internet
newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
csmp.games. It is designed for people who read news semi-regularly and
want an archive of the discussions. If you don't know what a
newsgroup is, you probably don't have access to it. Ask your systems
administrator(s) for details. If you don't have access to news, you
may still be able to post messages to the group by using a mail server
like anon.penet.fi (mail help@anon.penet.fi for more information).
Each issue of the digest contains one or more sets of articles (called
threads), with each set corresponding to a 'discussion' of a particular
subject. The articles are not edited; all articles included in this digest
are in their original posted form (as received by our news server at
nef.ens.fr). Article threads are not added to the digest until the last
article added to the thread is at least two weeks old (this is to ensure that
the thread is dead before adding it to the digest). Article threads that
consist of only one message are generally not included in the digest.
The digest is officially distributed by two means, by email and ftp.
If you want to receive the digest by mail, send email to listserv@ens.fr
with no subject and one of the following commands as body:
help Sends you a summary of commands
subscribe csmp-digest Your Name Adds you to the mailing list
signoff csmp-digest Removes you from the list
Once you have subscribed, you will automatically receive each new
issue as it is created.
The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
Questions related to the ftp site should be directed to
scott.silver@dartmouth.edu.
-------------------------------------------------------
>From ted@sophocles.algonet.se (Ted Parnefors)
Subject: Asynchronous Serial Com.
Date: 26 Oct 1995 22:30:23 +0100
Organization: AlgoNet Public Access Node, Stockholm
I was hoping that i could find someone here with some knowledge of how to
read/write data over a serial port on the macintosh asynchronously. I
found pieces of code everywhere, but unfortunatly it seems like you can
do this is lots of different ways on the macintosh (either by using a
serial driver or by using device manager) but nothing that i could patch
together to one piece of code that opens the port and then sends a byte
asynchronously and then closes the port, this mainly due to the fact that
I just getting started with programming C on the macintosh. Anyhow, any
hints where to begin or a code fragment in c or some hints to where i
could look to find a solution would be greatly appreciated. I had a look
in the "serial driver" secton of inside macintosh but could only find how
to open a serial driver and send data synchronously which is not what i
want to do...
Cheers,
Ted
+++++++++++++++++++++++++++
>From colen@teleport.com (Colen Garoutte-Carson)
Date: Fri, 27 Oct 1995 15:36:25 +0100
Organization: Metrowerks Inc.
In article <46oulf$rmc@sophocles.algonet.se>, ted@sophocles.algonet.se
(Ted Parnefors) wrote:
> I was hoping that i could find someone here with some knowledge of how to
> read/write data over a serial port on the macintosh asynchronously. I
> found pieces of code everywhere, but unfortunatly it seems like you can
> do this is lots of different ways on the macintosh (either by using a
> serial driver or by using device manager) but nothing that i could patch
> together to one piece of code that opens the port and then sends a byte
> asynchronously and then closes the port, this mainly due to the fact that
> I just getting started with programming C on the macintosh. Anyhow, any
> hints where to begin or a code fragment in c or some hints to where i
> could look to find a solution would be greatly appreciated. I had a look
> in the "serial driver" secton of inside macintosh but could only find how
> to open a serial driver and send data synchronously which is not what i
> want to do...
Ted,
Once you have opened a serial port, you can use the input and output
driver reference numbers as you would file reference numbers. You can
pass them to FSRead, FSWrite, or PBRead and PBWrite. PBRead and PBWrite
can be called asynchronously.
Have you use asynchronous IO of any kind of a Macintosh?
- Colen Garoutte-Carson, Metrowerks Inc.
+++++++++++++++++++++++++++
>From ted@sophocles.algonet.se (Ted Parnefors)
Date: 30 Oct 1995 00:42:02 +0100
Organization: AlgoNet Public Access Node, Stockholm
Colen Garoutte-Carson (colen@teleport.com) wrote:
:
: Once you have opened a serial port, you can use the input and output
: driver reference numbers as you would file reference numbers. You can
: pass them to FSRead, FSWrite, or PBRead and PBWrite. PBRead and PBWrite
: can be called asynchronously.
: Have you use asynchronous IO of any kind of a Macintosh?
Hi Colen,
Well, no i've never used any kind of asynchronous I/O on any kind of
macintosh, actually this is my first go with programming on the
macintosh. From what i understood from the Inside Machintosh 'serial
driver' part, PBRead & PBWrite was only for synchronous transfer, but
it's not then or? From what i understood one had to go through a device
manager to use a serial port for asynchronous calls, which seemed like an
even worse jungle.
-Ted
+++++++++++++++++++++++++++
>From oster@netcom.com (David Phillip Oster)
Date: Mon, 30 Oct 1995 01:32:44 GMT
Organization: IOpener
In article <4713ga$at7@sophocles.algonet.se>, ted@sophocles.algonet.se
(Ted Parnefors) wrote:
> Well, no i've never used any kind of asynchronous I/O on any kind of
> macintosh, actually this is my first go with programming on the
> macintosh. From what i understood from the Inside Machintosh 'serial
> driver' part, PBRead & PBWrite was only for synchronous transfer, but
> it's not then or? From what i understood one had to go through a device
> manager to use a serial port for asynchronous calls, which seemed like an
> even worse jungle.
The current approved way to do this is:
Use CRMSearch() to present the user with a list of serial devices on this
macintosh.
When the user has chosen a serial port, open it, both for input and output
using OpenDriver() as in:
OpenDriver("\p.AIn, &in);
OpenDriver("\p.AOut", &out);
use SerReset() to set the parameters of the port, such as 8 data bits, 1 stop
bit, 9600 baud, hardware handshaking.
Use PBWriteAsync() to write a byte as
io.ioCompletion = NULL;
io.ioRefNum = out;
io.ioBufdAddr = &c;
io.ioReqCnt = 1;
PBWriteAsync(&io);
if ioCompletion is not null, then the mac thinks it is the address of a
completion routine and calls it at interrupt time, when the io is actually
done.
You can poll io.ioResult to see when the io completes (it will be "1" while
the io is in progress.)
- ------- oster@netcom.com ----------
"A man hears what he wants to hear and misremembers the rest."
-- Paul Simon, ("The Boxer")
+++++++++++++++++++++++++++
>From isis@netcom.com (Mike Cohen)
Date: Mon, 30 Oct 1995 18:05:42 GMT
Organization: ISIS International
In article <4713ga$at7@sophocles.algonet.se>,
ted@sophocles.algonet.se (Ted Parnefors) wrote:
>
>Well, no i've never used any kind of asynchronous I/O on any kind of
>macintosh, actually this is my first go with programming on the
>macintosh. From what i understood from the Inside Machintosh 'serial
>driver' part, PBRead & PBWrite was only for synchronous transfer, but
>it's not then or? From what i understood one had to go through a device
>manager to use a serial port for asynchronous calls, which seemed like an
>even worse jungle.
>
No, PBRead & PBWrite can be used either synchronously or asynchronously by
setting a bit in the trap word or using PBReadSync or PBReadAsync. When you
call those functions asynchronously (assuming you're using them with a
device that supports asnyc I/O), they will return immediately with the
IOResult field in the param block set to 1. You can either poll IOResult
for 0 or a negative value or simply have it call your completion proc when
the operation completes. Note that the completion proc gets called at
interrupt level, so you can't allocate memory or do many other things from
it. The safest thing to do is have it set a flag or start another
asynchronous I/O operation (although some drivers may have a problem with
that).
--
Mike Cohen - isis@netcom.com
Home page: ftp://ftp.netcom.com/pub/is/isis/home.html
Sound is the same for all the world - Youssou N'dour, "Eyes Open"
+++++++++++++++++++++++++++
>From colen@teleport.com (Colen Garoutte-Carson)
Date: Tue, 31 Oct 1995 13:07:12 +0100
Organization: Metrowerks Inc.
In article <4713ga$at7@sophocles.algonet.se>, ted@sophocles.algonet.se
(Ted Parnefors) wrote:
> Well, no i've never used any kind of asynchronous I/O on any kind of
> macintosh, actually this is my first go with programming on the
> macintosh.
Ted,
There's a good bit of information on Asynchronous I/O in the Think
Reference (page: "Async I/O"), if you have access to it.
> From what i understood from the Inside Machintosh 'serial
> driver' part, PBRead & PBWrite was only for synchronous transfer, but
> it's not then or?
PBRead and PBWrite can be executed either synchronously or asynchronously.
>From what i understood one had to go through a device
> manager to use a serial port for asynchronous calls, which seemed like an
> even worse jungle.
PBRead and PBWrite, for example, are both File Manager and Device
Manager routines. Those two routines are really the extent of the Device
Manager that you need to use.
- Colen Garoutte-Carson, Metrowerks Inc.
---------------------------
>From suicyco@tiac.net (Harold Nicely)
Subject: Auto-Installing Software
Date: 3 Nov 1995 20:48:42 GMT
Organization: The Internet Access Company
Hi there,
I've got some files I'd like to have auto-installed by clicking on an
installer application from a disk and inserting the appropriate disks as
the installer program deems appropriate (like installing any other kind
of program). Are there any shareware products that I can use to help me
do this?
Oh, I also need these files compressed.
Any help would be greatly appreciated. Please respond by email if you
can as my access to newsgroups is slow and laggy and quite the pain. :)
Thanks,
Sean Hussey
+++++++++++++++++++++++++++
>From eric.kidd@dartmouth.edu (Eric M. Kidd)
Date: 5 Nov 1995 16:39:16 GMT
Organization: Dartmouth College
In article <47dv7a$fc7@sundog.tiac.net>, suicyco@tiac.net (Harold Nicely) wrote:
> I've got some files I'd like to have auto-installed by clicking on an
> installer application from a disk and inserting the appropriate disks as
> the installer program deems appropriate (like installing any other kind
> of program). Are there any shareware products that I can use to help me
> do this?
>
> Oh, I also need these files compressed.
I don't know of any shareware installers, but there are some relatively
cheap ones. All of these can be found on the Apprentice CD or in the
standard archives. Here's what I discovered when looking for an installer
recently:
DeveloperVISE, DeveloperVISE Lite
Contact <mailto:mindvision@mindvision.com>. Supports reasonable
compression, has a passable UI, and can install fiendishly complex
packages. Metrowerks and Apple both use this for many products. The really
great point in DeveloperVISE's favor is its price: DeveloperVISE Lite is
free for freeware and shareware authors. (This is what I'm currently
using.)
StuffIt InstallerMaker
Contact <mailto:dev.sales@aladdinsys.com>. In my testing, StuffIt
InstallerMaker produced archives about 25% smaller than DeveloperVISE
Lite. The interface is *really* simple; if you can operate StuffIt, you
can operate InstallerMaker. I made fewer mistakes building test installers
with this than with DeveloperVISE Lite because I could see all the
installation information at once. Apple has used this in the past, and it
produces some of the most aesthetic installers out there, IMHO. There's a
low per-year license fee for shareware and freeware use. Check it out.
SmallerInstaller
This was written by the author of Compact Pro and is used by Ambrosia
software for all their games. It doesn't support really complex
installation instructions, and the build process is less integrated than
that of the two above installers. However, it produces slick packages when
you're done. Licensing seems to be by volume, but talk to them for
details.
Apple Installer
This is the mother of all Macintosh installers. It's big, relatively
hard to use, and can do absolutely *anything*--if you're willing to figure
it out. Compression has historically been poorly integrated but that seems
to be changing. Costs unkown; I didn't look very far into this option.
DragInstall
DragInstall has a entirely different installation paradigm than the
others. It displays an icon for each installation package and an icon for
each possible destination drive. The user selects a package and drags it
to a disk. As best as I remember, it supports compression and a built-in
scripting language.
If I've omitted any products, or made any mistakes in my evaluations,
please feel free to correct me. Free demos of all the above
products--except possibly the Apple Installer--are available.
We really need a "How To Choose a Mac Installer FAQ". =)
Cheers,
Eric
........................................................................
Eric Kidd (eric.kidd@dartmouth.edu) http://coos.dartmouth.edu/~emk/
"Computers are useless. They can only give you answers." -Pablo Picasso
---------------------------
>From "Alfred L. Poy" <poy@ecn.purdue.edu>
Subject: Deferred Task Help...
Date: 2 Nov 1995 00:45:07 GMT
Organization: Purdue University
I'm programming an app on the PowerMac platform in which I would like to install
a deferred task to be run at interrupt time. I've set up a UPP for the deferred
task procedure, then I install the task as follows:
procedure InstallManipulateSndTask;
var
myErr: OSErr;
theTask: DeferredTask;
begin
with theTask do
begin
qType := ORD(dtQType);
dtAddr := MyManipulateSndProcUPP;
dtParam := gMyA5;
dtReserved := 0;
end;
gTaskError := DTInstall(@theTask);
end;
When I call this procedure, it seems to install the task with no errors. Then
interrupt time comes around and then my task is supposed to execute. Following
the Inside Mac guidelines, this is what my task looks like:
procedure ManipulateSoundDefTask;
var
myParam: longint;
begin
myParam := $00000000;
DoManipulateSound(myParam);
end;
procedure DoManipulateSound (A5value: longint);
begin
{ gBuffDataReady := false;}
gMetersReady := true;
end;
The work is split into two procedures for supposed compatibility with optimizing
compilers. So here's what happens... When the first line of the DoManipulateSound
routine is commented out, the program will run without crashing. When I uncomment
the first line, the program crashes. I assume I am just lucky that the program runs
when the first line is commented out. BTW, any variables beginning with "g" are
global variables.
So what rules am I breaking, or what bad assumptions have I made? I know that in
the 68K environment, you need to set A5 before accessing globals. But I thought this
wasn't necessay for PPC.
Thanks for your help.
Al Poy
Purdue University
Email: poy@ecn.purdue.edu
+++++++++++++++++++++++++++
>From jumplong@aol.com (Jump Long)
Date: 2 Nov 1995 23:57:53 -0500
Organization: America Online, Inc. (1-800-827-6364)
Alfred L. Poy wrote:
>I'm programming an app on the PowerMac platform in which I would
>like to install a deferred task to be run at interrupt time.
>I've set up a UPP for the deferred task procedure, then I
>install the task as follows:
>
> procedure InstallManipulateSndTask;
> var
> myErr: OSErr;
> theTask: DeferredTask;
> begin
> with theTask do
> begin
> qType := ORD(dtQType);
> dtAddr := MyManipulateSndProcUPP;
> dtParam := gMyA5;
> dtReserved := 0;
> end;
> gTaskError := DTInstall(@theTask);
> end;
The DeferredTask record needs to be a global or a locked block of memory.
In your code, you allocated theTask as a local variable on the stack of
the InstallManipulateSndTask procedure. When the code for the procedure
ends, the stack space used for local variables is released and thus, your
DeferredTask is released. The next time something allocates stack space
for some other purpose, the space formerly used for theTask is overwritten
and the that corrupts the Deferred Task queue.
You might want to read the Macintosh Technical Note that covers deferred
tasks. It covers all the rules you'll need to know when using deferred
tasks.
- Jim Luther
+++++++++++++++++++++++++++
>From poy@ecn.purdue.edu (Alfred L. Poy)
Date: Fri, 03 Nov 1995 23:36:26 -0600
Organization: Purdue University
In article <47c7gh$62f@newsbf02.news.aol.com>, jumplong@aol.com (Jump
Long) wrote:
> The DeferredTask record needs to be a global or a locked block of memory.
>
> In your code, you allocated theTask as a local variable on the stack of
> the InstallManipulateSndTask procedure. When the code for the procedure
> ends, the stack space used for local variables is released and thus, your
> DeferredTask is released. The next time something allocates stack space
> for some other purpose, the space formerly used for theTask is overwritten
> and the that corrupts the Deferred Task queue.
> - Jim Luther
Yup. That was the problem (along with a few other minor bugs).
Works like a charm now. Thanks for your help.
Al Poy
Purdue University poy@ecn.purdue.edu
---------------------------
>From "Ted J. Pederson" <sweetp@scruznet.com>
Subject: GX Font menus
Date: 26 Oct 1995 22:39:42 GMT
Organization: Future Labs, Inc.
What is the recommended interface to allow users to select the
font, font size, and font style in a GX app? The "Basic
Layout" sample shows how to select any if the available fonts.
Adding size would be easy, but should a good app also allow
italic, bold, etc. from another menu, and, if so, is there
a way to not let the user italicize an already italic font?
Thanks,
Ted Pederson
+++++++++++++++++++++++++++
>From opstad@apple.com (David Opstad)
Date: 27 Oct 1995 09:10:12 -0700
Organization: Apple Computer Inc, Cupertino, CA
In article <46p2ne$rlk@news.scruz.net>,
Ted J. Pederson <sweetp@scruznet.com> wrote:
>What is the recommended interface to allow users to select the
>font, font size, and font style in a GX app? The "Basic
>Layout" sample shows how to select any if the available fonts.
>Adding size would be easy, but should a good app also allow
>italic, bold, etc. from another menu, and, if so, is there
>a way to not let the user italicize an already italic font?
This is a really good question. GX introduces so many new options that it's
hard to come up with a user interface for selecting them that is simple,
and at the same time relatively comprehensive. I guess my overall comment
would be to not necessarily tie yourself to the model that QuickDraw imposed
on the Mac world -- a fixed number of styles, and no real font family
organization. Since you have access to mechanisms like textfaces and
variations in GX, a given family might have 8 different gradations of
bold alone, and you want to make sure your user has access to them.
As to not italicizing an already italic font, heck, if the user really
wants to do that, why not? I've obtained some visually fascinating results
by backslanting Zapf Chancery so the letters appear upright, just for fun.
Just like all the playfulness with type that happened when the Mac first
came out, I think we should let users be even more playful in the much
larger playground that is GX. :-)
Dave Opstad
GX Line Layout Weenie
+++++++++++++++++++++++++++
>From vision@cc.swarthmore.edu (Frank Durgin, Stephen Sample, and various student researchers)
Date: Fri, 27 Oct 1995 13:28:07 -0400
Organization: Swarthmore Visual Perception Lab
In article <46p2ne$rlk@news.scruz.net>, "Ted J. Pederson"
<sweetp@scruznet.com> wrote:
> What is the recommended interface to allow users to select the
> font, font size, and font style in a GX app? The "Basic
> Layout" sample shows how to select any if the available fonts.
> Adding size would be easy, but should a good app also allow
> italic, bold, etc. from another menu, and, if so, is there
> a way to not let the user italicize an already italic font?
Well, you could always make the style menu have 'slant', 'embolden',
'condense', 'extend' (or 'oblique', 'heavy', 'tight', 'loose'), etc.
Slanting an italic font seems like a reasonable operation, as does
emboldening (effectively, increasing the pen width of the font outline) a
bold or black font. This also deals properly with fonts which don't have
multiple styles in their family (if the family doesn't have an italic
member, most programs slant the regular font on the supposition that
oblique is sort of vaguely like italic; maybe).
If you don't want to allow oblique italic as a style, then in your switch
statement handling style menu selections, you'd check whether the font
family has an italic member, and toggle between the regular and italic
members if so; if not, you'd toggle between oblique and regular versions
of the font. If there are mixed fonts in the selection, this could be
ugly.
Ta,
-Stephen
--
Frank Durgin, Stephen Sample, & various student researchers
- --------------------------
Visual Perception Laboratory
Department of Psychology
Swarthmore College
+++++++++++++++++++++++++++
>From KTrueman@ixmedia.com (Kenneth Trueman)
Date: Mon, 30 Oct 1995 07:29:56 -0500
Organization: QuickDraw GX Fan Club
In article <46p2ne$rlk@news.scruz.net>, "Ted J. Pederson"
<sweetp@scruznet.com> wrote:
>What is the recommended interface to allow users to select the
>font, font size, and font style in a GX app? The "Basic
>Layout" sample shows how to select any if the available fonts.
>Adding size would be easy, but should a good app also allow
>italic, bold, etc. from another menu, and, if so, is there
>a way to not let the user italicize an already italic font?
>
>Thanks,
>Ted Pederson
We've been having this sort of discussion on the QuickDraw GX Mailing
lists. There is one that is specifically geared for developers
(GXDEVList). You'll find over 60 people there with expereince developing
for GX. Dave Opstad is a member too ...
You can find out more by visiting the QuickDraw GX Fan Club on the web at :
http://www.ixmedia.com/quickgx/
and if you want specific information on subscribing, check out :
http://www.ixmedia.com/quickgx/subscribe.html
Or you can just e-mail <autoshare@ixmedia.com> with the body message :
subscribe gxdevlist ted pederson
Kenneth
--
ktrueman@ixmedia.com
Hungry for GX info ? Check out the QuickDraw GX Fan Club pages :
<http://www.ixmedia.com/quickgx/quickgx.html>
---------------------------
>From schmeul@umich.edu (Sam Huffman)
Subject: GetWRefCon returns NULL if app is in background?
Date: 27 Oct 1995 20:23:01 GMT
Organization: University of Michigan
I'm having a problem with GetWRefCon (or more likely with my code that
used GetWRefCon :). As part of my dialog event loop I call a function
"HandleDlgDefault" which takes care of some busy work (updating the dialog
based on values, etc...)
So all this works happily as long as my application is in the foreground.
But the second I switch to another app I get a type 1 error. Basically my
procedure checked to see if there was a window open (using FrontWindow()).
Then I did GetWRefCon (my app only has one kind of window all of which
have the same struct stuffed into the refcon). I didn't bother to check if
this was NULL because I figured it wasn't necessary; if there was a window
open in my app, i could expect it to have a refcon.
So I solved the problem by checking if the return value from GetWRefCon
was NULL. My question is why do I have to do this? Does GetWRefCon not
return the proper value unless the application is in the foreground? Any
comments would be appreciated (preferably by e-mail).
Thanks in advance!
Sam Huffman
schmeul@umich.edu
Boolean HandleDlgDefault(EventRecord *theEvent)
{
short theEditText;
Point thePoint;
DialogPtr theDialog;
dialogInfo *theInfo;
if ((theDialog = FrontWindow()) == NULL) return;
if ((theInfo = (dialogInfo *)GetWRefCon(theDialog)) == NULL) return;
// If I just do theInfo = (dialogInfo *)GetWRefCon(theDialog)) and then
// continue through my code I crash in the two conditionals below. Why??
// Does GetWRefCon not return the refcon if my application isn't the
// current app?
// I added the above line to solve the problem. So things work well
// now but I'm still curious why I had the problem in the first place
theEditText = CurrentEditField(theDialog);
if ((theEditText == CalcMolFormTxt) || (theEditText == CalcListEdit)) {
SetDefaultButton(theDialog, CalcEnterButton);
} else SetDefaultButton(theDialog, CalcCalcButton);
if (GetListSelect(theInfo->percentList, &thePoint) && (thePoint.h == 1))
ShowDItem(theDialog, CalcListEdit);
else HideDItem(theDialog, CalcListEdit);
SetCursor(&arrow);
return(false);
}
+++++++++++++++++++++++++++
>From Matt Slot <fprefect@umich.edu>
Date: 29 Oct 1995 22:28:29 GMT
Organization: University of Michigan
Sam Huffman, schmeul@umich.edu writes:
> So I solved the problem by checking if the return value from
> GetWRefCon was NULL. My question is why do I have to do this? Does
> GetWRefCon not return the proper value unless the application is in
> the foreground? Any comments would be appreciated (preferably by
> e-mail).
You have forgotten to set the SIZE flags for MultiFinder-aware. When
you switch layers, the compatibility code in the Process Manager will
create a little-bitty window way off in the 30000 coordinate range to
convince your front window that it should un-hilite... much like a DA
or other System Window would. You must be walking the window list, and
stumbling over this.
This one gave me 4 hours of grief after my project partner rebuilt the
project... I hope I saved you some of that grief. :)
Matt
---------------------------
>From pj@stacken.kth.se (Patrik Johansson)
Subject: How to add plug-in`s to an application
Date: Sun, 01 Oct 1995 17:28:19 +0100
Organization: KTH
We are developing a utility program (printer utility) and now we are
thinking about plug-ins. When we started to develop our program it was
intended to be a rahter small program with very limited number of
functions so that all functions was "hardcoded" in the application. That
was in the begining...
As of know, the number of functions have risen to the point were it is no
longer practical (or even possible) to keep them all in the mainprogram so
we are thinking about making the program "plug-in-able".
In our specific case, the program mainly consist of two parts, one witch
handles the communication with the printers (Findind, open connection,
sending, receiving etc) and the other part, the functions that the user
sees and uses and the parts that accualy send data to the printer.
What we want to do here is to be able to keep all the programfunctions as
seperate objects/plug-ins that use the mainapplication as sort of a
communicationcenter. Then each object would provide its own userinterface
to the user (altough in a standard way) and, via the mainapplication,
communicate with the printers. Ofcource the objects should not be runned
as separate applications but rather activated when the user choose this
function in a menu (or simular) in the main application. Ofcource, it
would be even better if the mainapp-plugin interface would be so easy so
that other ppl could write plugins for our app.
The program is developed in CodeWarrior/Powerplant.
Ok, how do we accomplish this? What we are looking for here is not 100%
solution (but if you have one..:-) but rather some ideas on how to solve
it, input from ppl that has tried to do this before, how other programs
that use plugins are used etc. And, there is really no need to discus this
from our program`s point of view but rather from a general, "how to add
plug-ins".
Also, feel free to answer some questions that you feel is missing here if
you find any.
Finaly, please dont respond via email since i belive this would be an
interesting discussion that many ppl would like to be part in.
Sincerely,
Patrik Johansson
- ------------------------------------------------------------
Patrik Johansson
Royal Institute of Technology, Sweden
pj@stacken.kth.se
- ------------------------------------------------------------
+++++++++++++++++++++++++++
>From dunham@nw.pensee.com (David Dunham)
Date: Sun, 01 Oct 1995 12:53:01 -0700
Organization: Pensee Corporation
In article <pj-0110951728190001@sl52.modempool.kth.se>, pj@stacken.kth.se
(Patrik Johansson) wrote:
> We are developing a utility program (printer utility) and now we are
> thinking about plug-ins.
Code resources. I wrote an article on this for MacTutor back in the dark
ages (may have even been the first article on plug-ins, not that I
originated the idea -- printer drivers are probably the first Mac
implementation). Have a folder full of files, each containing one (or
more) code resources of the specified type (such as 'PLUG'). Load the
resource, lock it, dereference it into a function pointer, and execute the
function.
I haven't implemented this in years, so I'm not sure how you handle
PowerPC code; I suspect one way would be to also store a code fragment in
the same file and execute it instead.
David Dunham Pensee Corporation dunham@nw.pensee.com
Voice/Fax 206 783 7404 http://www.pensee.com/dunham/
"I say we should listen to the customers and give them what they want."
"What they want is better products for free." --Scott Adams
+++++++++++++++++++++++++++
>From carl.gustafson@ece.drexel.edu (Carl Gustafson)
Date: 2 Oct 1995 14:24:07 GMT
Organization: Imaging and Computer Vision Center, Drexel University
In article <pj-0110951728190001@sl52.modempool.kth.se>, pj@stacken.kth.se
(Patrik Johansson) wrote:
> We are developing a utility program (printer utility) and now we are
> thinking about plug-ins. When we started to develop our program it was
> intended to be a rahter small program with very limited number of
> functions so that all functions was "hardcoded" in the application. That
> was in the begining...
>
> [snip]
>
> Ok, how do we accomplish this? What we are looking for here is not 100%
> solution (but if you have one..:-) but rather some ideas on how to solve
> it, input from ppl that has tried to do this before, how other programs
> that use plugins are used etc. And, there is really no need to discus this
> from our program`s point of view but rather from a general, "how to add
> plug-ins".
>
Look at the source code for NIH-Image, by Wayne Rasband at the National
Institutes of Health. It provides basic support for plug-ins, and is
MetroWerks/Pascal based.
You can ftp it from:
zippy.nimh.nih.gov
--
Carl Gustafson
Imaging and Computer Vision Center
Drexel University, Philadelphia, Penna
- ----------------------------------------------------------
I don't speak for Drexel, and Drexel doesn't listen to me...
+++++++++++++++++++++++++++
>From pj@stacken.kth.se (Patrik Johansson)
Date: Wed, 04 Oct 1995 19:59:20 +0100
Organization: KTH
> Have a folder full of files, each containing one (or
> more) code resources of the specified type (such as 'PLUG'). Load the
> resource, lock it, dereference it into a function pointer, and execute the
> function.
Ok, anyone that can explain how to access coderesources more in general?
I have never tried it so i dont know how hard it is? And, the most
important, how does the plugin and the mainapp communicate?
Pj
- ------------------------------------------------------------
Patrik Johansson
Royal Institute of Technology, Sweden
pj@stacken.kth.se
- ------------------------------------------------------------
+++++++++++++++++++++++++++
>From dunham@nw.pensee.com (David Dunham)
Date: Thu, 05 Oct 1995 10:08:39 -0700
Organization: Pensee Corporation
In article <pj-0410951959200001@sl06.modempool.kth.se>, pj@stacken.kth.se
(Patrik Johansson) wrote:
> > Have a folder full of files, each containing one (or
> > more) code resources of the specified type (such as 'PLUG'). Load the
> > resource, lock it, dereference it into a function pointer, and execute the
> > function.
>
> Ok, anyone that can explain how to access coderesources more in general?
> I have never tried it so i dont know how hard it is? And, the most
> important, how does the plugin and the mainapp communicate?
Gee, I thought my explanation was pretty general. Or do you want more detail?
typedef word (*PROCPTR)(...);
handle = GetResource('PLUG', 64); /* Get a handle to the PROC */
HLock(handle); /* Hold down the PROC */
error = (**(PROCPTR *)handle)(arg1, arg2, callback);
HUnlock(handle); /* Let it float in the heap again */
The main app communicates to the plugin by calling it. The plugin could
communicate back by returning a value, or the main app could pass in a
pointer to a callback routine.
David Dunham Pensee Corporation dunham@nw.pensee.com
Voice/Fax 206 783 7404 http://www.pensee.com/dunham/
"I say we should listen to the customers and give them what they want."
"What they want is better products for free." --Scott Adams
+++++++++++++++++++++++++++
>From Ron Nicholson <rhn@sgi.com>
Date: 5 Oct 1995 18:53:01 GMT
Organization: Silicon Graphics, Inc.
dunham@nw.pensee.com (David Dunham) wrote:
..
>Gee, I thought my explanation was pretty general. Or do you want more detail?
>
> typedef word (*PROCPTR)(...);
>
> handle = GetResource('PLUG', 64); /* Get a handle to the PROC */
> HLock(handle); /* Hold down the PROC */
> error = (**(PROCPTR *)handle)(arg1, arg2, callback);
> HUnlock(handle); /* Let it float in the heap again */
>
>The main app communicates to the plugin by calling it. The plugin could
>communicate back by returning a value, or the main app could pass in a
>pointer to a callback routine.
I'd make sure these issues are also addressed:
- What plug-in modules are available at runtime?
- Are they in the default directory or can the user move them?
- How easy is it for the user to add/configure plug-in modules?
- Are there resource conflicts among several resource files (use Get1Resource)?
- Was there a file manager error?
- Was there a resource manager error?
- Is the code resource the right version number?
- Is the code resource 68K, PPC, fat or safe-fat?
- Are you calling from a 68K or PPC?
- I the callback handler the correct version?
- Where do errors in the callback handler get handled?
- How do you handle a variable number of parameters?
- etc.
Furthermore, another method of handling plug-in's is to construct them as
background applications; launch them and then communicate with them via
AppleEvents. This is usefull when you don't want a GNU public license
contaminated module to possibly infect your application.
- -
Ronald H. Nicholson, Jr. rhn@engr.sgi.com, rhn@netcom.com
#include <canonical.disclaimer> // I speak only for myself, etc.
+++++++++++++++++++++++++++
>From cho@kenner.demon.co.uk (Chris Orgill)
Date: Fri, 06 Oct 1995 00:27:23 +0100
Organization: (none)
In article <pj-0410951959200001@sl06.modempool.kth.se>, pj@stacken.kth.se
(Patrik Johansson) wrote:
> > Have a folder full of files, each containing one (or
> > more) code resources of the specified type (such as 'PLUG'). Load the
> > resource, lock it, dereference it into a function pointer, and execute the
> > function.
>
> Ok, anyone that can explain how to access coderesources more in general?
> I have never tried it so i dont know how hard it is? And, the most
> important, how does the plugin and the mainapp communicate?
>
> Pj
>
> --------------------------------------------------------------
> Patrik Johansson
> Royal Institute of Technology, Sweden
> pj@stacken.kth.se
> --------------------------------------------------------------
Why aren't you using the Component Manager ? (see
NIM: More Mac Toolbox)
Best,
Chris Orgill
+++++++++++++++++++++++++++
>From nagle@netcom.com (John Nagle)
Date: Mon, 9 Oct 1995 02:04:23 GMT
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
>In article <pj-0410951959200001@sl06.modempool.kth.se>, pj@stacken.kth.se
>(Patrik Johansson) wrote:
>> Ok, anyone that can explain how to access coderesources more in general?
>> I have never tried it so i dont know how hard it is? And, the most
>> important, how does the plugin and the mainapp communicate?
See
"http://www.info.apple.com/dev/technotes/Platforms_&_Tools/pt_35.html"
There's no real Mac standard for plug-ins, short of going to OpenDoc.
Every app that supports them does it differently.
John Nagle
+++++++++++++++++++++++++++
>From english@primenet.com (Lawson English)
Date: 14 Oct 1995 21:33:35 GMT
Organization: Primenet (602)395-1010
John Nagle (nagle@netcom.com) wrote:
: >In article <pj-0410951959200001@sl06.modempool.kth.se>, pj@stacken.kth.se
: >(Patrik Johansson) wrote:
: >> Ok, anyone that can explain how to access coderesources more in general?
: >> I have never tried it so i dont know how hard it is? And, the most
: >> important, how does the plugin and the mainapp communicate?
: See
: "http://www.info.apple.com/dev/technotes/Platforms_&_Tools/pt_35.html"
: There's no real Mac standard for plug-ins, short of going to OpenDoc.
: Every app that supports them does it differently.
But one can make an app OpenDOcable relatively easily...
--
- -----------------------------------------------------------------------------
Lawson English __ __ ____ ___ ___ ____
english@primenet.com /__)/__) / / / / /_ /\ / /_ /
/ / \ / / / / /__ / \/ /___ /
- -----------------------------------------------------------------------------
+++++++++++++++++++++++++++
>From crawford@scipp.ucsc.edu (Mike Crawford)
Date: 14 Oct 1995 22:47:16 GMT
Organization: UC Santa Cruz - SCIPP
[stepping up on soapbox]
Yeah, Brother, I want you to Hear the Revealed Truth:
Use the Word Services Apple Event Suite. It will change
your life, save your marriage, and make your crops grow
again!
[stepping off]
Depending on what you are doing, using an interapplication
method like Word Services may suit your needs.
Word Services allows any application to link to a speller,
grammar checker or other text service as if it is a built-in
menu item.
http://www.scruznet.com/~crawford/WordServices/wdsvindex.html
--
Mike Crawford | I use anonymous digital cash from DigiCash
crawford@scruznet.com | Please don't use non-anon First Virtual.
crawford@maxwell.ucsc.edu | Participate in the e-Cash trial at:
http://www.scruznet.com/~crawford/ | http://www.digicash.com
+++++++++++++++++++++++++++
>From PaulS101@mailbox.ioa.com (Paul Sexton)
Date: 17 Oct 1995 19:29:32 GMT
Organization: Vnet Internet Access, Charlotte, NC - info@char.vnet.net
In article <45pabf$j70@nnrp1.news.primenet.com>, english@primenet.com
(Lawson English) wrote:
> John Nagle (nagle@netcom.com) wrote:
> : >In article <pj-0410951959200001@sl06.modempool.kth.se>, pj@stacken.kth.se
> : >(Patrik Johansson) wrote:
> : >> Ok, anyone that can explain how to access coderesources more in general?
> : >> I have never tried it so i dont know how hard it is? And, the most
> : >> important, how does the plugin and the mainapp communicate?
>
> : See
> : "http://www.info.apple.com/dev/technotes/Platforms_&_Tools/pt_35.html"
>
> : There's no real Mac standard for plug-ins, short of going to OpenDoc.
> : Every app that supports them does it differently.
>
> But one can make an app OpenDOcable relatively easily...
>
Get hold of the Adobe Illustrator plug-in SDK. (Comes with CW.) It's
fairly easy reading & a good intro to the most common way of doing it.
Also, read PowerPC System software on the topic of shared libraries: if
you're running PPC (or CFM68K, someday) there's a way to call functions
from your application without the call back mechanism (by using your app
as a code fragment that the plug-in links to).
+++++++++++++++++++++++++++
>From Samuel_Reynolds@lamg.com (Samuel Reynolds)
Date: 30 Oct 1995 19:00:00 GMT
Organization: Los Angeles Macintosh Group BBS
There's a cross-platform plugin framework on the Apprentice 3 CD called XPIN.
I haven't used it (just came across it while browsing the CD), but it might
do what you need.
- Sam
---------------------------
>From oster@netcom.com (David Phillip Oster)
Subject: How to call 68K code from Power PC (Was: Apple OneScanner Libraries: how to use them in PPC Code)
Date: Fri, 20 Oct 1995 13:09:37 GMT
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
In article <ACA7F63C966888110@194.21.60.10> cecchett@server.tdnet.it (Paolo Cecchetti) writes:
>
>Did anyone try to control Apple Scanner from PPC C code ?
>I think it's impossible because Apple Scanner Library is 68k, source code
>is not available and you CAN'T use the Driver Manager directly because in a
>particula command you have to pass two addresses on the stack. But I'm not
>sure about it. Did anyone write a new glue code for the Scanner ?
Passing a pointer to executable PowerPC code is done with the now familiar
idiom:
static UserItemUPP myUpdateUPP = NIL;
if(NULL == myUpdateUPP){
myUpdateUPP = NewUserItemProc(MyUpdate);
}
after which you use myUpdateUPP in place of MyUpdate, in every place that
you would have previously passed a reference to the callback routine
MyUpdate.
Going in the other direction is not so well known: i.e., you have a resource
of excutable code, that you _know_ is 68K, and you need to call it from
code that might be compiled either as power pc or 68k.
Here is an example of calling a 68K routine (stored in an executable
resource) from Power PC code (actually, it will work under either.)
/* CallModalStyledTE.c - this calls a 68K code resource, and is usable either from
68K or powerpc code.
By David Phillip Oster.
freely redistributable
tested 10/18/95
*/
#include "ModalStyledTE.h" // declares our entrypoint: ModalStyledTE
#ifdef __cplusplus
extern "C" {
#endif
/* My code resource is a handle of one of these:
*/
typedef pascal OSErr (*ModalStyledTEFunc)(Handle textH, StScrpHandle scrapH, short *justP);
#if GENERATINGCFM
typedef UniversalProcPtr ModalStyledTEUPP;
enum{
uppModalStyledTEInfo = kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(StScrpHandle)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *)))
};
#define NewModalStyledTE(userRoutine) \
(ModalStyledTEUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalStyledTEInfo, kM68kISA)
#else
typedef ModalStyledTEFunc ModalStyledTEUPP;
#endif
OSErr ModalStyledTE(Handle textH, StScrpHandle scrapH, short *justP){
ModalStyledTEFunc *f;
OSErr val;
SignedByte state;
if(NULL != (f = (ModalStyledTEFunc *) GetResource('msTE', 128))){
LoadResource((Handle) f);
state = HGetState((Handle) f);
HLock((Handle) f);
HNoPurge((Handle) f);
#ifdef powerc
{ModalStyledTEUPP msteupp = NewModalStyledTE(*f);
val = CallUniversalProc(msteupp, uppModalStyledTEInfo, textH, scrapH, justP);
DisposeRoutineDescriptor(msteupp);
}
#else
val = (**f)(textH, scrapH, justP);
#endif
HSetState((Handle) f, state);
}else{
val = resNotFound;
}
return val;
}
#ifdef __cplusplus
};
#endif
--
- ------- <mail-to:oster@netcom.com> ----------
Ahh! The thorazine is wearing off and the odinazine is coming on...
+++++++++++++++++++++++++++
>From pottier@drakkar.ens.fr (Francois Pottier)
Date: 3 Nov 1995 13:37:50 GMT
Organization: Ecole Normale Superieure, Paris
In article <osterDGr0K1.Gqu@netcom.com>,
David Phillip Oster <oster@netcom.com> wrote:
>#ifdef powerc
> {ModalStyledTEUPP msteupp = NewModalStyledTE(*f);
> val = CallUniversalProc(msteupp, uppModalStyledTEInfo, textH, scrapH, justP);
> DisposeRoutineDescriptor(msteupp);
> }
>#else
You don't need to do this. The 68k ISA is special; in order to retain
compatibility with previous CFM-unaware code, any raw 68k procedure
pointer is a valid UPP. Hence, you only need to write:
val = CallUniversalProc((UniversalProcPtr) *f, uppModalStyledTEInfo, textH, scrapH, justP);
and it'll work fine. The Mixed Mode Manager will realize that the
address pointed to by *f isn't a routine descriptor, because it
doesn't start with the magic cookie 0xAAFE. Hence, it'll assume it is
68k code.
(CFM-unaware 68k code never starts with 0xAAFE because it's the trap number for
the CFM dispatch code! God, what a brilliant hack.)
--
Francois
pottier@dmi.ens.fr
http://www.eleves.ens.fr:8080/home/pottier/
---------------------------
>From Warwick Tobin <warwick@aee.com>
Subject: Missing-character glyphs in double-byte fonts?
Date: 1 Nov 1995 06:57:01 GMT
Organization: AEE, Inc.
How do you determine if a given character in a font displays the
missing-character glyph (usually an empty rectangle) when rendered?
Specifically, how do you do this with a double-byte font such as
Honmincho? I am hoping there is a toolbox function to do this, rather
than having to render each character and compare it to a bitmap of the
missing-character glyph. The CharacterType function comes close to
providing this information, but not quite.
I need to know how to do this because I am writing some code that must
render all the valid printable characters in a Japanese font to a file.
Sprinkled throughout the thousands of Kanji chararacters, there must be
at least a hundred or so of the missing-character glyphs, which needn't
be rendered.
Thanks for any help,
Warwick Tobin
warwick@aee.com
wtobin@mailer.fsu.edu
+++++++++++++++++++++++++++
>From rac@intrigue.com (Robert Coie)
Date: Fri, 03 Nov 1995 13:53:42 -0800
Organization: Intrigue Corporation
In article <4775nt$j5h@news.fsu.edu>, Warwick Tobin <warwick@aee.com> wrote:
: How do you determine if a given character in a font displays the
: missing-character glyph (usually an empty rectangle) when rendered?
: Specifically, how do you do this with a double-byte font such as
: Honmincho? I am hoping there is a toolbox function to do this, rather
: than having to render each character and compare it to a bitmap of the
: missing-character glyph. The CharacterType function comes close to
: providing this information, but not quite.
There is an additional subtlety which you may have noted by the fact that
you said "usually an empty rectangle". I have seen two different
"unprintable" glyphs, which we jokingly named after two popular types of
tofu (which they sort of look like), neither of which is the traditional
single-byte empty rectangle from Roman fonts. What I would do is open the
'sfnt' resource and walk the 'cmap' table, trying to print everything that
has an entry.
: I need to know how to do this because I am writing some code that must
: render all the valid printable characters in a Japanese font to a file.
You might also be interested in the fact that depending on which font you
are using (i.e. TrueType or Type 1, and which System version, whether ATM
is installed and some other obscure stuff that I've forgotten), some
characters will show up correctly on the screen but not print and some
will print correctly even though they look like tofu on the screen. The
origin of the problem was a conflict between the way NEC and MITI decided
to encode certain characters (the only ones that I've ever seen anybody
use are the numbers enclosed in a circle). Somewhere there was a
KanjiTalk developers note that described the problem, although I remember
having to read it about 20 times before I understood a word it was talking
about.
Robert Coie rac@intrigue.com
Implementor, Intrigue Corporation AppleLink: INTRIGUE
---------------------------
>From Richard Wesley <hawkfish@punchdeck.com>
Subject: Shared library version control (Was: Save me from MFC!!!)
Date: 23 Oct 1995 17:48:24 GMT
Organization: Punch Deck Consulting
dent@highway1.com.au (Andy Dent) wrote:
>2) Talk to a Windows developer about their problems with version control.
>If you're using shared libraries any application being installed
>subsequent to yours can invisibly blow you away.
I have done some Windows work and I know exactly what you mean.
It really freaks me out that few people seem to be worrying about this.
One of the Mac's biggest selling points is cheap and easy maintainence,
which this whole shared library thing just flushes down the toilet
(pardon my French...) Anyone else feel this way?
- rmgw
http://www.punchdeck.com/hawkfish/PunchDeck.html
- --------------------------------------------------------------------------
Richard Wesley hawkfish@punchdeck.com | "What was that popping sound?"
Punch Deck Consulting pnchdeck@aol.com | "A paradigm shifting without a
Macintosh Software Development | clutch." - Dilbert (Scott Adams)
- --------------------------------------------------------------------------
+++++++++++++++++++++++++++
>From awiner@oracle.com (Adam Winer)
Date: Mon, 23 Oct 1995 13:27:09 -0800
Organization: Oracle Corporation
In article <46gkh8$4ua@news.halcyon.com>, Richard Wesley
<hawkfish@punchdeck.com> wrote:
> dent@highway1.com.au (Andy Dent) wrote:
> >2) Talk to a Windows developer about their problems with version control.
> >If you're using shared libraries any application being installed
> >subsequent to yours can invisibly blow you away.
>
> I have done some Windows work and I know exactly what you mean.
> It really freaks me out that few people seem to be worrying about this.
> One of the Mac's biggest selling points is cheap and easy maintainence,
> which this whole shared library thing just flushes down the toilet
> (pardon my French...) Anyone else feel this way?
Well, actually, the Code Fragment Manager has a very nifty
version control mechanism built in; see PowerPC System
Software, 3-7 to 3-10. It lets you make sure that your application
binds only to libraries with which it will definitely be compatible.
It also lets you have multiple versions of the same library installed,
and still be confident that each application will use only a version
that's compatible. Quite nifty stuff, though it's rarely used.
A caveat: setting the old definition version to a nonzero number
makes it impossible to use GetSharedLibrary() on that code fragment.
-- Adam Winer
awiner@us.oracle.com
+++++++++++++++++++++++++++
>From jthill@netcom.com (Jim Hill)
Date: Tue, 24 Oct 1995 03:21:07 GMT
Organization: biological <-- hey! a one-word oxymoron!
In article <46gkh8$4ua@news.halcyon.com>, Richard Wesley
<hawkfish@punchdeck.com> wrote:
>One of the Mac's biggest selling points is cheap and easy maintainence,
>which this whole shared library thing just flushes down the toilet
>(pardon my French...) Anyone else feel this way?
Check the CFM docs. Cheap and easy maintenance, as advertised: if it
can't find the exact library your app was compiled for, it loads the
latest version that supports the same interface. It just works, no
fiddling. Drat. Have to find something else to be proud of. Dang macs
must be toys.
Jim
--
Jim Hill Contents public domain and worth $.02 more than you paid.
jthill@netcom.com PGPrint: 6B 85 76 D1 EF BA 2C 78 12 25 8A 5A BF F3 37 7E
+++++++++++++++++++++++++++
>From ajv@rmit.edu.au (Andrew van der Stock)
Date: Mon, 30 Oct 1995 20:07:27 +1100
Organization: RMIT Business Faculty
>> dent@highway1.com.au (Andy Dent) wrote:
>> >2) Talk to a Windows developer about their problems with version control.
>> >If you're using shared libraries any application being installed
> >subsequent to yours can invisibly blow you away.
The ASLM has very nifty version control. You can have various
versions of the library in there, if neccesary, and you can ask for
a specific version, or just ask, and it will give you the latest.
Nice. Shame it needs to be linked via MPW.
Andrew
--
"Being digital, whatever it means,
means having it your way." - Nicholas Negroponte
Andrew van der Stock, Systems Administrator
Computing Services Group, RMIT Business Faculty
see http://www.bf.rmit.edu.au/~ajv for contact details
+++++++++++++++++++++++++++
>From dent@highway1.com.au (Andy Dent)
Date: Tue, 31 Oct 1995 22:48:23 +0800
Organization: A.D. Software
In article <awiner-2310951327090001@awiner-mac2.us.oracle.com>,
awiner@oracle.com (Adam Winer) wrote:
>Well, actually, the Code Fragment Manager has a very nifty
>version control mechanism built in;
...
It lets you make sure that your application
>binds only to libraries with which it will definitely be compatible.
Adam, I think you're missing my point.
What happens when someone installs a later version of the library
(unknowingly) with which your app is no longer compatible?
This is an install-time issue, not a runtime issue, about file replacement.
Andy Dent, Product Architect, A.D. Software, Western Australia
OOFILE - "the cross-platform OODBMS that speaks c++"
ftp://ftp.highway1.com.au/pub/adsoftware/oofile/
http://www.highway1.com.au/adsoftware/oofile.html
+++++++++++++++++++++++++++
>From bc@wetware.com (monsieur HAINEUX)
Date: Tue, 31 Oct 1995 10:41:27 -0800
Organization: GRAFIX::CODERRE
dent@highway1.com.au (Andy Dent) wrote:
| What happens when someone installs a later version of the library
| (unknowingly) with which your app is no longer compatible?
|
| This is an install-time issue, not a runtime issue, about file replacement.
Yup, it sure is, (says mister installer script guy).
The best way around it I can think of is to make everything you do be
forward-compatible, so that you still run with newer libraries.
The second best way, it seems to me, is to keep both libraries around by a
renaming trick, and take the hit on extra lib files bloating your system
folder.
bc
+++++++++++++++++++++++++++
>From Etay_Bogner@mail.stil.scitex.com (Etay Bogner)
Date: Wed, 01 Nov 1995 11:02:21 +0200
Organization: Scitex Corp.
In article <bc-3110951041270001@mac840.kip.apple.com>, bc@wetware.com
(monsieur HAINEUX) wrote:
>> dent@highway1.com.au (Andy Dent) wrote:
>> | What happens when someone installs a later version of the library
>> | (unknowingly) with which your app is no longer compatible?
>> |
>> | This is an install-time issue, not a runtime issue, about file
replacement.
>>
>>
>> Yup, it sure is, (says mister installer script guy).
>>
>> The best way around it I can think of is to make everything you do be
>> forward-compatible, so that you still run with newer libraries.
>>
CFM will NOT use newer shared libraries unless the interface version is
the same.
CFM has three version number stored in each fragment ( see the PEF panel ) :
Old Definition
Old Implementation
Current Version.
-- Etay Bogner,
-- Etay_Bogner@mail.stil.scitex.com,
-- Scitex Corp.
-- Israel.
+++++++++++++++++++++++++++
>From chris_page@powertalk.claris.com (Chris Page)
Date: Thu, 02 Nov 1995 10:21:14 -0800
Organization: Claris Corporation
In article <bc-3110951041270001@mac840.kip.apple.com>, bc@wetware.com
(monsieur HAINEUX) wrote:
> The second best way, it seems to me, is to keep both libraries around by a
> renaming trick, and take the hit on extra lib files bloating your system
> folder.
You could also store the old and new versions of the libary in the same file.
--
Chris Page | Internet junk mail, advertisements,
Claris Corporation | and SPAMs bite...
chris_page@powertalk.claris.com | Cut it out! :-P
Disclaimer: opinions are not necessarily those of my employer
---------------------------
>From "Dr. Douglas Cheyne" <cheyne@sfu.ca>
Subject: Video Paging versus CopyBits...
Date: 25 Oct 1995 02:35:12 GMT
Organization: Simon Fraser University
I am currently under the impression the doing a copybits operation
from an offscreen bitmap is the usual method for buffered video on
the Mac, wheras, swapping video pages on other platforms provides a
more instantaneous switch from one image to the next. Is there any
way to do the latter on the Mac? Does it require 3rd party hardware?
Thanks,
Doug Cheyne,
Simon Fraser University,
Burbaby, B.C.Canada.
cheyne@sfu.ca
+++++++++++++++++++++++++++
>From RobTerrell@vmedia.com (Rob Terrell)
Date: Wed, 25 Oct 1995 19:26:16 -0500
Organization: Fringe Multimedia, Inc.
In article <46k7p0$l6@morgoth.sfu.ca>, "Dr. Douglas Cheyne"
<cheyne@sfu.ca> wrote:
> I am currently under the impression the doing a copybits operation
> from an offscreen bitmap is the usual method for buffered video on
> the Mac, wheras, swapping video pages on other platforms provides a
> more instantaneous switch from one image to the next. Is there any
> way to do the latter on the Mac? Does it require 3rd party hardware?
>
There has been no way to switch page buffers since the Mac Plus. (I think
the Plus supported it, anyway.) You might be able to make page flipping
work with 3rd party hardware, but then you're limiting your audience to
folks with that hardware.
If you're willing to limit your audience, you can skip CopyBits and write
directly to the screen hardware, using your own copying routines. (See
"Tricks of the Mac Game Programming Gurus" for some fast copybits
replacements.)
The preferred method uses CopyBits, since CopyBits can be made to work
with any number of strange and various video cards and drivers. And it's
pretty good on PowerMacs. I can get 30fps on my raycaster, which CopyBits
the buffer to the screen.
Rob
+++++++++++++++++++++++++++
>From andrewwelc@aol.com (AndrewWelc)
Date: 25 Oct 1995 19:31:00 -0400
Organization: America Online, Inc. (1-800-827-6364)
> Is there any way to do the latter on the Mac? Does it require 3rd party
> hardware?
There is no standard way to do video paging that works on all Mac models.
Use the CopyBits method you spoke of.
+--------------------------------------------------------------+
| Andrew Welch - Thaumaturgist - Ambrosia Software, Inc. |
+------------------------------+-------------------------------+
| AOL-> Keyword: Ambrosia | Internet-> www.AmbrosiaSW.com |
| CIS-> GO word: Ambrosia | eWorld-> Shortcut: Ambrosia |
+------------------------------+-------------------------------+
+++++++++++++++++++++++++++
>From kfc@wimsey.com (Ken Cunningham)
Date: Thu, 26 Oct 1995 06:17:22 -0700
Organization: Online at Wimsey
In article <RobTerrell-2510951926160001@slip37-240-91.ibm.net>,
RobTerrell@vmedia.com (Rob Terrell) wrote:
> In article <46k7p0$l6@morgoth.sfu.ca>, "Dr. Douglas Cheyne"
> <cheyne@sfu.ca> wrote:
>
> > I am currently under the impression the doing a copybits operation
> > from an offscreen bitmap is the usual method for buffered video on
> > the Mac, wheras, swapping video pages on other platforms provides a
> > more instantaneous switch from one image to the next. Is there any
> > way to do the latter on the Mac? Does it require 3rd party hardware?
> >
>
> There has been no way to switch page buffers since the Mac Plus. (I think
> the Plus supported it, anyway.) You might be able to make page flipping
> work with 3rd party hardware, but then you're limiting your audience to
> folks with that hardware.
>
> If you're willing to limit your audience, you can skip CopyBits and write
> directly to the screen hardware, using your own copying routines. (See
> "Tricks of the Mac Game Programming Gurus" for some fast copybits
> replacements.)
>
> The preferred method uses CopyBits, since CopyBits can be made to work
> with any number of strange and various video cards and drivers. And it's
> pretty good on PowerMacs. I can get 30fps on my raycaster, which CopyBits
> the buffer to the screen.
>
I believe that other systems may not be using page flipping much longer
anyway, for the same reason that it was dumped on the mac -- hardware
video cards at high resolutions and bit depths do not contain enough
memory to allow multiple pages (too expensive), and the card's memory
architectures are generally incompatible with each other.
This sort of page flipping was OK under DOS and with the very early Mac
systems, but it's not compatible with modern equipment and demands.
+++++++++++++++++++++++++++
>From hubertv@cs.kun.nl (Hubert Voogd)
Date: 26 Oct 1995 22:30:28 GMT
Organization: University of Nijmegen, The Netherlands
In <RobTerrell-2510951926160001@slip37-240-91.ibm.net> RobTerrell@vmedia.com (Rob Terrell) writes:
>In article <46k7p0$l6@morgoth.sfu.ca>, "Dr. Douglas Cheyne"
><cheyne@sfu.ca> wrote:
>> I am currently under the impression the doing a copybits operation
>> from an offscreen bitmap is the usual method for buffered video on
>> the Mac, wheras, swapping video pages on other platforms provides a
>> more instantaneous switch from one image to the next. Is there any
^^^^^^^^^^^^^
>> way to do the latter on the Mac? Does it require 3rd party hardware?
>>
[Arguments for using CopyBits snipped]
>The preferred method uses CopyBits, since CopyBits can be made to work
>with any number of strange and various video cards and drivers. And it's
>pretty good on PowerMacs. I can get 30fps on my raycaster, which CopyBits
>the buffer to the screen. ^^^^^
30 frames per second is not the problem here, I think. The goal of using
video paging is presenting an entire image at once. If you have a 90 Hz
monitor and use CopyBits to have 30 frames per second, then one frame takes
3 vertical blanks. One Image must be presented in one vertical blank.
In Douglas' application (as well as mine), brain signals are measured
which have a very strict timing. It is very important to have an image
presented instantaneously.
Because you can change the position of the displayed screen in the monitors
control panel, I think it is possible to switch screen pages. Even the sound
handling resembles the way you can play sounds in a copper list, as used on
Amiga's, so I think the Mac uses a sort of copper list itself. I couldn't
find this in the documentation though, so if anyone knows about this, let
me know too, because in the near future, I will also have to present
large colored images in one frame. I thought of using different color palettes,
but using animatepalette, causes the window to update because of an update
event. That's not what I want, I only want the color to change, not the drawing
itself.
Regards, Hubert
+++++++++++++++++++++++++++
>From scullin@fife.cs.uiuc.edu (Will Haro Scullin)
Date: 27 Oct 1995 18:11:47 GMT
Organization: University of Illinois at Urbana
In article <kfc-2610950617220001@pm026.vcr.wis.net> kfc@wimsey.com (Ken Cunningham) writes:
>
> I believe that other systems may not be using page flipping much longer
> anyway, for the same reason that it was dumped on the mac -- hardware
> video cards at high resolutions and bit depths do not contain enough
> memory to allow multiple pages (too expensive), and the card's memory
> architectures are generally incompatible with each other.
>
> This sort of page flipping was OK under DOS and with the very early Mac
> systems, but it's not compatible with modern equipment and demands.
That depends on what you mean by modern equipment and demands -- modern
graphics workstations may support as many as 4 pages at high
resolution/bit depth, for just the reason that copying 1280x1024x24 bits
to video memory at 30 frames/second just isn't reasonable.
Will
--
| Will Scullin |
| University of Illinois |
| scullin@uiuc.edu |
| http://www-pablo.cs.uiuc.edu/~scullin/ |
+++++++++++++++++++++++++++
>From english@primenet.com (Lawson English)
Date: 28 Oct 1995 20:11:11 GMT
Organization: Primenet (602)395-1010
AndrewWelc (andrewwelc@aol.com) wrote:
: > Is there any way to do the latter on the Mac? Does it require 3rd party
: > hardware?
: There is no standard way to do video paging that works on all Mac models.
: Use the CopyBits method you spoke of.
I believe that some of the newer low-end models support an x-mode-ish
video mode.
Also, there is an API for PCI cards that supports this.
I believe that the guy that did Tempest port (Arashi?) has some generic
code to do page-flipping on NuBus cards, since there is an API for
pageflipping on NuBus cards which apparently virtually no available card
uses.
The biggest problem is not that there is no standard way (there are only
a few ways supported, so if you learn them, you should be set), but that
Apple doesn't document them in places where games writers look for them.
At least *I* wouldn't have thought to look in the writing Mac-card-driver
docs for info on how to use page-flipping in a Mac video game...
The other problem is that since Apple doesn't let anyone know that they
exist, everyone thinks that they don't and don't bother to track them down.
--
- -----------------------------------------------------------------------------
Lawson English __ __ ____ ___ ___ ____
english@primenet.com /__)/__) / / / / /_ /\ / /_ /
/ / \ / / / / /__ / \/ /___ /
- -----------------------------------------------------------------------------
+++++++++++++++++++++++++++
>From jmunkki@beta.hut.fi (Juri Munkki)
Date: 30 Oct 1995 05:10:33 GMT
Organization: Helsinki University of Technology
In article <46u2ov$1a9@nnrp1.news.primenet.com> english@primenet.com (Lawson English) writes:
>I believe that the guy that did Tempest port (Arashi?) has some generic
>code to do page-flipping on NuBus cards, since there is an API for
>pageflipping on NuBus cards which apparently virtually no available card
>uses.
Arashi does more than page flipping, but it uses palette animation to do it.
There are two background bitplanes (single buffered) and double buffered
3 bit (8 color) buffer. For this reason, Arashi has take over the full
screen at 8 bits/pixel and still only provides 10 different colors (background,
bitplane 1&2, and double buffered 7 colors + transparent).
There are other disadvantages to using palette changes. The main problem
is that the timing depends on the video card driver: some wait for
vertical blanking and some do not.
The API you mentioned exists, but most cards just support one page anyway.
I think Oids is one of the few games that use it.
--
Juri Munkki jmunkki@iki.fi There ain't no such thing as a shareware lunch.
http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind.
---------------------------
End of C.S.M.P. Digest
**********************